﻿CREATE TABLE [dbo].[Scores]
(
	[ScoreID] INT NOT NULL PRIMARY KEY, 
    [SchoolYearID] INT NOT NULL, 
    [ClassID] INT NOT NULL, 
    [SemesterID] INT NOT NULL, 
    [TypeScoreID] INT NOT NULL, 
    [StudentID] NCHAR(20) NOT NULL, 
    [SubjectID] INT NOT NULL, 
    [Score] FLOAT NOT NULL,
	CONSTRAINT FK_Scores_SchoolYears FOREIGN KEY (SchoolYearID) 
    REFERENCES SchoolYears (SchoolYearID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Scores_Classes FOREIGN KEY (ClassID) 
    REFERENCES Classes (ClassID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Scores_Semesters FOREIGN KEY (SemesterID) 
    REFERENCES Semesters (SemesterID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Scores_TypeScores FOREIGN KEY (TypeScoreID) 
    REFERENCES TypeScores (TypeScoreID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Scores_Students FOREIGN KEY (StudentID) 
    REFERENCES Students (StudentID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Scores_Subjects FOREIGN KEY (SubjectID) 
    REFERENCES Subjects (SubjectID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
)
